package com.neusoft.yuejian_6.model;

import com.neusoft.yuejian_6.javabean.Club;
import com.neusoft.yuejian_6.service.ClubService;

import java.util.List;

import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

import static com.neusoft.yuejian_6.base.Constant.BASE_URL;

/**
 * Created by Q on 2017/10/18.
 */

public class ClubModel {
    private Retrofit retrofit;

    public ClubModel() {
        retrofit = new Retrofit.Builder()
                .baseUrl(BASE_URL)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }

    public Call getClubs() {
        ClubService clubService = retrofit.create(ClubService.class);
        return clubService.getAllClubs();
    }
    public Call<Club> Clubsdetail(int club_id){
        ClubService clubService=retrofit.create(ClubService.class);
        return clubService.getClubById(club_id);
    }

    public Call<List<Club>> searchClub(String club_name){
        ClubService clubService = retrofit.create(ClubService.class);
        return  clubService.searchClub(club_name);
    }
}
